let str:string ="123"
console.log(str);
let num:number=1
console.log(num);
let con:boolean=true
console.log(con);
let obj:object={
    age:"18",
    name:"小明"
}
console.log(obj);


let yz:[string,number]=["字符串",123]
console.log(yz);

let fun=(a:number,b:number):number=>{
    return a+b
}
console.log(fun);


console.log("数组去重");

let newArr:number[]=[11,12,13,13,14,14,15,15]

let newBrr:number[]=[]

console.log("去重前",newArr);

newArr.forEach((item:number,index:number)=>{
    if(!newBrr.includes(item)){
        newBrr.push(item)
    }
})

console.log("去重后",newBrr);

console.log("删除");

let arr1:number[]=[1,2,3,4,5,6]
console.log(arr1);


arr1.forEach((item:number,index:number)=>{
    if(index==4){
        arr1.splice(item,1)
    }
})
console.log(arr1);
console.log("添加");

let arr2:number[]=[1,2,3,4,5,6]
console.log(arr2);

arr2.push(7)
console.log(arr2);

var myPush=function(){
    var arr=arguments[0];
    for(var i=1; i<arguments.length; i++){
        arr[arr.length]=arguments[i];
    }
    console.log(arr);
    return arr.length
}

console.log(myPush);

// console.log("二维转一维");
// let array:number[][]=[[1,2,3,4]]
// console.log(array);

// let array: ArrayKeyAny[] = [ [ "123" : 123 ] ]

let array=[["a","b"],["c","d","e"],["f"]]

function twoToOne(){
    let arrs:number[]=[]
    for(let j=0; j<arrs.length; j++){
        arrs.push(j)
    }
}
